<?php
declare (strict_types = 1);

namespace app\middleware;

use think\facade\Session;

class Auth
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response|\think\response\Redirect
     */
    public function handle($request, \Closure $next)
    {
        if(!isLogin()){
        Session::flash('danger','请先登录~');//提示用户要登陆才能到调用路由，比如你尚未登录不能跳转到修改个人信息页
        return redirect((string) url('login.create'));
    }
        return $next($request);
    }
}
